<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/view/include/taglib.jsp" %>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">	
	<title>上传浏览</title>
    <link href="${project}/ds/css/styles.css" rel="stylesheet" />
    <link href="${project}/ds/lib/layui/css/layui.css" rel="stylesheet" />
    <link href="${project}/ds/lib/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" />
    <link href="${project}/ds/lib/ligerUI/skins/Gray2014/css/all.css" rel="stylesheet" />
</head>
<body>
    <div style="padding:5px;">
		<div class="layui-form-item">
		    <div class="layui-inline">
		        <div id="savebtn" onclick="CheckUrd()" class="layui-btn layui-btn-normal">保存</div>
		    </div>
		    <div id="grid"></div>
		</div>
	</div>
<script src="${project}/ds/lib/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="${project}/ds/lib/ligerUI/js/core/base.js" type="text/javascript"></script>
<script src="${project}/ds/lib/ligerUI/js/ligerui.min.js" type="text/javascript"></script>
<script src="${project}/ds/lib/jquery.form.js"></script>
<script src="${project}/ds/lib/layui/layui.js" type="text/javascript"></script>
<script src="${project}/ds/js/XHD.js" type="text/javascript"></script>
<script type="text/javascript">
    var manager;
    var banname;
    var nodeId;
    var nodeType;
    var nodeOrder;
    $(function () {
        var fileName = decodeURI(getparastr("fileName"));
         console.log(fileName);
         banname = decodeURI(getparastr("ldName"));
         console.log(banname);
         nodeId = getparastr("nodeId");
         nodeType = getparastr("nodeType");
         nodeOrder = getparastr("nodeOrder");        
        //url = urldecode(url);

        manager = $("#grid")
            .ligerGrid({
                columns: [
                    {
                        display: '序号',
                        width: 50,
                        render: function (rowData, rowindex) {
                            return rowindex + 1;
                        }
                    },
                    { display: "ID", name: "D_ID", width: 80, editor: { type: 'text' } },
                   /*  { display: "楼栋", name: "D_BanName", width: 80 }, */
                    { display: "室号", name: "D_RoomNo", width: 80, editor: { type: 'text' } },
                    { display: "单元", name: "D_Unit", width: 60, editor: { type: 'text' } },
                    { display: "面积", name: "D_FloorArea", width: 80, editor: { type: 'text' } },
                    { display: "套内面积", name: "D_InnerArea", width: 80, editor: { type: 'text' } },
                    { display: "分摊面积", name: "D_AssessmentArea", width: 80, editor: { type: 'text' } },
                    { display: "原单价", name: "D_Price", width: 120, editor: { type: 'text' } },
                    { display: "原总价", name: "D_Total", width: 120, editor: { type: 'text' } },
                    { display: "折后单价", name: "D_discountPrice", width: 120, editor: { type: 'text' } },
                    { display: "折后总价", name: "D_discountTotal", width: 120, editor: { type: 'text' } },
                    { display: "对应列", name: "D_column", width: 80, editor: { type: 'text' } },
                    { display: "单元名称", name: "d_position", width: 80, editor: { type: 'text' } },
                    { display: "户型", name: "D_HouseModel", width: 80, editor: { type: 'text' } },
                    { display: "类型", name: "D_RoomType", width: 80, editor: { type: 'text' } },
                    { display: "内控", name: "D_Monitor", width: 80 },
                    { display: "假收藏", name: "D_CollectionCount", width: 80, editor: { type: 'text' } },
                    { display: "真收藏", name: "E_CollectionCount", width: 80, editor: { type: 'text' } }
                    /*{ display: "型号", name: "Specifications", width: 80, editor: { type: 'text' } },
                    { display: "车位类型", name: "CarType", width: 80, editor: { type: 'text' } }*/
                ],
                dataAction: 'server',
                usePager: false,
                enabledEdit: true,
//                delayLoad: true,
                width: '100%',
                height: '100%',
                heightDiff: -1,
                url: "/fangyuan/readFangYuanByExcel?fileName="+fileName,
                onRClickToSelect: true
            });
    });

    function CheckUrd() {
        var rows = manager.getData();
        var postdata = JSON.stringify(rows);

        var index = parent.layer.getFrameIndex(window.name);
        $.ajax({
            url: "/fangyuan/addGrid",
            type: "post",
            dataType: "json",
            data: { json: postdata,banname:banname,nodeId:nodeId,nodeType:nodeType,nodeOrder:nodeOrder },
            success: function (result) {
                if (result.result === "true") {
                	parent.layer.msg("保存成功");
                	parent.layer.close(index);
                	parent.f_reload();
                } else if (result.result === "false") {
                	parent.layer.msg(result.msg);
                }
            }
        });
        
    }

</script>
</body>
</html>
